From: Carlos Garnacho Date: Wed, 3 Feb 2021 15:54:25 +0000 (+0100) Subject: swipeTracker: Reject touch swipes in the wrong directions X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~616^2^2~311 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=ea881ed0777578f58d163f9ade25d18a40e8c563;p=gnome-shell.git swipeTracker: Reject touch swipes in the wrong directions We now have multiple touch swipe gestures with matching fingers and different directions set on the overview hierarchy. Accepting all touch swipes without checking the direction makes one of these gestures take control of input, without other gestures having a say on this. So, look for the direction of the touch events and look if it matches the expected orientation before accepting the gesture. Part-of: --- diff --git a/js/ui/swipeTracker.js b/js/ui/swipeTracker.js index cf5e01d71..1bd8a69c9 100644 --- a/js/ui/swipeTracker.js +++ b/js/ui/swipeTracker.js @@ -247,6 +247,12 @@ const TouchSwipeGesture = GObject.registerClass({ let time = this.get_last_event(0).get_time(); let [xPress, yPress] = this.get_press_coords(0); let [x, y] = this.get_motion_coords(0); + const [xDelta, yDelta] = [x - xPress, y - yPress]; + const swipeOrientation = Math.abs(xDelta) > Math.abs(yDelta) + ? Clutter.Orientation.HORIZONTAL : Clutter.Orientation.VERTICAL; + + if (swipeOrientation !== this.orientation) + return false; this._lastPosition = this.orientation === Clutter.Orientation.VERTICAL ? y : x;